<!-- 模板 -->
<template>
  <div class="root">
    <header>
      <i @click="back()" class="back iconfont left-icon"></i>
      <div class="tit">全部订单</div>
      <div></div>
    </header>
    <div class="tab">
      <a
        href="##"
        v-for="(item, index) in nav"
        :class="index === activeIndex ? 'active' : ''"
        :key="item.id"
        @click="toComp(item.path, index)"
      >
        <div>
          <span>{{ item.name }}</span>
        </div>
        <div class="actives"></div>
      </a>
    </div>
    <div class="contentRouter">
      <router-view></router-view>
    </div>
  </div>
</template>
<script>
// import request from '../utils/request.js'
export default {
  name: '',
  data() {
    return {
      activeIndex: 0,
      nav: [
        {
          id: 1,
          name: '全部订单',
          path: '/orderAll',
        },
        {
          id: 2,
          name: '重学/赠送',
          path: '/otherOrder',
        },
        {
          id: 3,
          name: '课程售后',
          path: '/otherOrder',
        },
      ],
    }
  },
  props: [],
  components: {},
  computed: {},
  filters: {},
  methods: {
    back() {
      this.$router.go(-1)
    },
    toComp(path, index) {
      this.activeIndex = index
      this.$router.push(path)
    },
  },
  created() {},
  mounted() {},
}
</script>
<style lang="less" scoped>
// @import url(); 引入公共css类
.root {
  background-color: #f7f7f7;
  font-size: 0.28rem;
  header {
    padding: 0.2rem;
    background-color: #fff;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .back {
      font-size: 0.32rem;
      font-size: 500;
    }
    .tit {
      font-size: 0.32rem;
      color: #333;
      font-weight: 700;
    }
    .submit {
      color: #fc1e1e;
    }
  }
  .tab {
    background-color: #fff;
    color: #666;
    padding: 0.24rem 0.2rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #f5f5f5;
    a {
      flex: 1;
      text-align: center;
    }
    .active {
      position: relative;
      font-size: 0.3rem;
      font-weight: 700;
      color: #fc1e1e;
      .actives {
        position: absolute;
        width: 20%;
        height: 0.05rem;
        border-radius: 1rem;
        background-color: #fc1e1e;
        bottom: -0.2rem;
        left: 50%;
        transform: translateX(-50%);
      }
    }
  }
}
</style>
